<?php
if(!defined('ADMIN')){
	exit('Access Denied');
}
$id=empty($_REQUEST['id'])?0:(int)$_REQUEST['id'];
if(empty($id)){
    jumpajax('300','订单号不能为空!','');
}

/*if(empty($_REQUEST['chef_id'])&&!empty($_REQUEST['is_given'])){
    jumpajax('300','厨师不能为空!','');
}*/
$token=md5(EZKEY.$id.$_SESSION['EZ_Admin']['id']);
if($token<>$_POST["token"]){
    jumpajax('300','提交失败!','');
}
$remark=trim($_POST["remark"]);
$opid=intval($_REQUEST["opid"]);
if($opid==1){
    $pdata=array("status"=>1,"ispay"=>1,"paytype"=>5,"remark"=>$remark);
    $ezhand->update("shopping3_order",$pdata,"id=".$id);
    
    jumpajax('200','预付订单确认操作成功！','index.php?mod=order&act=view&id='.$id,'forward');
}elseif($opid==2){
    
    $pdata=array("is_given"=>1,"remark"=>$remark);
    $ezhand->update("shopping3_order",$pdata,"id=".$id);
    
    jumpajax('200','下发订单完成！','index.php?mod=order&act=view&id='.$id,'forward');
}elseif($opid==3){

    IF(empty($_POST['fansid'])){
        jumpajax('300','选择厨师不能为空!','');
    }
    $pdata=array("status"=>2,"remark"=>$remark,'fansid'=>$_POST['fansid']);
    $ezhand->update("shopping3_order",$pdata,"id=".$id);
    
    jumpajax('200','订单可接完成！','index.php?mod=order&act=view&id='.$id,'forward');
}elseif($opid==4){
    $pdata=array("status"=>3,"ispay"=>2,"remark"=>$remark);
    $ezhand->update("shopping3_order",$pdata,"id=".$id);
    
    jumpajax('200','订单付款操作完成！','index.php?mod=order&act=view&id='.$id,'forward');
}
elseif($opid==5){
    $pdata=array("status"=>4,"remark"=>$remark);
    $ezhand->update("shopping3_order",$pdata,"id=".$id);

    jumpajax('200','订单完成！','index.php?mod=order&act=view&id='.$id,'forward');
}
elseif($opid==20){

    $pdata=array("status"=>-1,"remark"=>$remark);
    $ezhand->update("shopping3_order",$pdata,"id=".$id);
    
    jumpajax('200','订单废弃操作完成！','index.php?mod=order&act=view&id='.$id,'forward');

}

/////以下没用




elseif($opid==21){

    $pdata=array("ispay"=>0,"remark"=>$remark);
    $ezhand->update("shopping3_order",$pdata,"id=".$id);
    
    jumpajax('200','订单开启操作完成！','index.php?mod=order&act=view&id='.$id,'forward');
    
}elseif($opid==30){

    $pdata=array("sendstatus"=>8,"remark"=>$remark);
    $ezhand->update("shopping3_order",$pdata,"id=".$id);
    
    jumpajax('200','订单取货完成！','index.php?mod=order&act=view&id='.$id,'forward');
}elseif($opid==31){

    $pdata=array("sendstatus"=>4,"remark"=>$remark);
    $ezhand->update("shopping3_order",$pdata,"id=".$id);
    
    jumpajax('200','订单未取货设置完成！','index.php?mod=order&act=view&id='.$id,'forward');
}elseif($opid==32){
    $pdata=array("is_given"=>1);
    $ezhand->update("shopping3_order",$pdata,"id=".$id);
    
    jumpajax('200','下发订单完成！','index.php?mod=order&act=view&id='.$id,'forward');
    
}elseif($opid==33){
    //var_dump($_POST);
    $pdata=array("ordersn"=>$_POST['goodssn'],"chef_id"=>$_POST['chef_id'],"shop_id"=>$_SESSION['EZ_Admin']['shop_id'],"start_time"=>$_POST['start_time'],"stop_time"=>$_POST['stop_time'],"createtime"=>time());
    $pdata2=array("status"=>2);
    $ezhand->insert("shopping3_cheftime",$pdata);
    $ezhand->update("shopping3_order",$pdata2,"id=".$id);
    
    jumpajax('200','成功接收订单！','index.php?mod=order&act=view&id='.$id,'forward');
    
}

?>